<?php $browser = new Browser; ?>
<script type="text/javascript">
    var mode = <?php echo (isset($mode) ? $mode : 0); ?>;
    var browser = '<?php echo $browser->getBrowser() . ' ' . $browser->getVersion(); ?>';
    var status = <?php echo (isset($status) ? 'true' : '""'); ?>;
    var isLocked = <?php echo (isset($isLocked) ? 'true' : 'false'); ?>;
    var readOnly = <?php echo (isset($readOnly) ? 'true' : 'false'); ?>;
    var signatures = <?php echo ($signaturesData ? $signaturesData : '"[]"'); ?>;
    var commonData = <?php echo ($commonData ? $commonData : '"[]"'); ?>;
    var customData = <?php echo ($customData ? $customData : '"[]"'); ?>;
    var rules = <?php echo ($rules ? $rules : '"[]"'); ?>;
    var formatting = <?php echo ($formatting ? $formatting : '"[]"'); ?>;
    var requiredSignatures = <?php echo ($requiredSignatures ? $requiredSignatures : '"[]"'); ?>;
    var pointRatio = <?php echo ($pointRatio ? $pointRatio : '0'); ?>;
</script>
<form id="pdfForm" method="POST">
    <div id="form-data">
        <input id="cascadeChanges" name="cascadeChanges" type="hidden" value="0" />
        <?php if (!empty($hiddenFields)): ?>
            <?php foreach ($hiddenFields as $field): ?>
                <input type="hidden" name="<?php echo $field["name"]; ?>" value="<?php echo $field["value"]; ?>" fe_field="<?php echo $field["path"]; ?>" />
            <?php endforeach; ?>
        <?php endif; ?>
    </div>
    <div id="form-topbar" class="align-center">
        <?php if ($propertyCaseForm->status == PropertyCaseForm::STATUS_SUBMITTED): ?>
            <div id="form-topbar-outer" class="grad_navy">
                <div id="form-topbar-inner">
                    <?php if ($mode == 0): ?>
                        <?php if (!$readOnly): ?>
                            <button id="btnLockForm" type="button" class="no-margin link-button grey large with-icon float-left">
                                <img class="icon" src="/images/icons/fugue/lock.png" />
                                <span>Lock Form</span>
                            </button>
                        <?php endif; ?>
                        <div id="instructions" class="float-left" style="display: none;">
                            <div class="float-left">You need to: </div>
                            <ul class="float-left">
                                <li id="mandatoryFields"><a>Fill in <span id="mandatoryFieldsCount"></span> mandatory fields</a></li>
                                <li id="mandatorySignatures"><a>Sign in <span id="mandatorySignaturesCount"></span> location(s)</a></li>
                            </ul>
                        </div>
                        <button id="btnSave" type="submit" class="link-button green large with-icon float-right">
                            Save Form
                        </button>
                    <?php elseif ($mode == 2): ?>
                        <div class="">
                            <button id="btnAccept" type="submit" name="action" value="accept" class="no-margin link-button large with-icon float-left">
                                <img src="/images/icons/fugue/tick.png" />
                                Accept
                            </button>
                            <button id="btnReject" type="submit" name="action" value="reject" class="link-button large with-icon float-left">
                                <img src="/images/icons/fugue/cross.png" />
                                Reject
                            </button>
                        </div>
                    <?php endif; ?>
                </div>
            </div>
        <?php endif; ?>
        <?php if ($propertyCaseForm->status == PropertyCaseForm::STATUS_ACCEPTED): ?>
            <div id="status-bar" class="accepted grad_dark_green" style="top: 0px;">
                <h2>Accepted</h2>
            </div>
        <?php elseif ($propertyCaseForm->status == PropertyCaseForm::STATUS_REJECTED): ?>
            <div id="status-bar" class="rejected grad_red" style="top: 0px;">
                <h2>Rejected</h2>
            </div>
        <?php else: ?>
            <div id="status-bar" class="grad_orange" style="top: 45px;">
                <h2>Pending Review</h2>
            </div>
        <?php endif; ?>
    </div>
</form>
<div id="next-arrow" class="right" style="display: none;">Start</div>
<div id="pdf-pages" class="<?php echo ($readOnly ? "readonly" : ""); ?>" style="<?php echo ($propertyCaseForm->status == PropertyCaseForm::STATUS_SUBMITTED ? "margin-top: 90px" : ""); ?>">
    <?php echo $pdfForm->html; ?>
</div>
<div id="watermark"></div> 